<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>用户数据</title>
		<link rel="stylesheet" type="text/css" href="${s.base}/lib/layui/css/layui.css" />
		<link rel="stylesheet" type="text/css" href="${s.base}/css/base/index.css" />
	</head>

	<body>
	<div class="wrap-container clearfix">
		<div class="column-content-detail" id="tool">
			<form class="layui-form" action="">
				<div class="layui-form-item">
					<div class="layui-inline tool-btn">
						<button class="layui-btn layui-btn-small layui-btn-normal jumpTabBtn" type="button" data-tab-name="添加数据"  data-id="dictContentAddOrEdit" data-name="添加" data-url="/sysDictContent/getEdit?dictType=${dictType}">
							<i class="layui-icon">&#xe654;</i></button>
					<button class="layui-btn layui-btn-small layui-btn-danger deleteBtn"  type="button" data-url="/sysDictContent/delete">
							<i class="layui-icon">&#xe640;</i></button>
					</div>
                </div>
			</form>
			<div class="layui-form" id="table-list">
				<table id="entityList" lay-filter="entityList" class="cy-list-table"></table>
			</div>
		</div>
	</div>
	<!--操作-->
	<script type="text/html" id="entityBar">
		<a class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm layui-smbtn-green"  lay-event="edit">编辑</a>
		<button class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm layui-smbtn-red" lay-event="del">删除</button>
	</script>
	<script src="${s.base}/lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
	<script src="${s.base}/js/common.js" type="text/javascript" charset="utf-8"></script>
	<script>
        layui.use(['jquery','table','page','baseutil'],function(){
            var $ = layui.jquery,
            table = layui.table,
            page = layui.page,
			baseutil = layui.baseutil;
            var dictType='${dictType}';
            baseutil.post("/baseUserContent/list",{"dictType":dictType},function (result) {
                page.initDict("base_status",function (dictData) {
                    page.showDict($("#status"),page.aceeptDictContentList(dictData,"base_status"),"全部");
                    var data = result.data;
                    //列表
                    var tableIns = table.render({
                        elem: '#entityList',
                        data: data,
                        cellMinWidth : 95,
                        page : true,
                        height : "full-125",
                        limit : 20,
                        method:'post',
                        limits : [10,15,20,25],
                        id : "entityList",
                        cols : [[
							{type: 'checkbox', fixed: 'left'},
                            {type: 'numbers', title: '序号'},
                            {field: 'value', title: '字典键值',align:'center'},
                            {field: 'name', title: '字典标签',align:'center'},
                            {field: 'sort', title: '排序',align:'center'},
                            {field: 'status', title: '状态',align:'center', templet:function(d){
                                if(d.status=="1"){
                                    return '<span class="status-green">'+page.aceeptDictContentName(dictData,"base_status",d.status)+'</span>';
                                }else {
                                    return '<span class="status-grey">'+page.aceeptDictContentName(dictData,"base_status",d.status)+'</span>';
                                }
                            }},
                            {field: 'dictType', title: '字典项类型',align:'center'},
                            {field: 'remark', title: '备注',align:'center'},
                            {field: 'createtime', title: '创建时间', align:'center', minWidth:110, templet:function(d){
                                return new Date(d.createTime).Format("yyyy-MM-dd hh:mm:ss");
                            }},
                            {title: '操作',width:170, templet:'#entityBar',align:"center"}
                        ]]
                    });
                })

			});

            //监听行工具事件
            table.on('tool(entityList)', function(obj){
                var layEvent = obj.event,
                    data = obj.data;
                if(layEvent === 'edit'){ //编辑
                    page.edit("dictContentAddOrEdit","/sysDictContent/getEdit?id="+data.id,"字典数据编辑");
                }else if(layEvent === 'del'){ //删除
                    page.delete("/sysDictContent/delete", {"id":data.id,"_method":"DELETE"},"确定删除字典数据吗？",function (data) {
                        tableIns.reload();
                    });
                }
            });
        });
	</script>
	</body>

</html>